﻿Imports KOR.Helpers
Imports KOR.Support

Public Class Main
    Inherits System.Web.UI.MasterPage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        LoadCategories()
    End Sub

    Private Sub LoadCategories()
        Try
            Using reader As IDataReader = BL.Categories.GetAllCategories()
                Me.div_categories.InnerHtml += "<ul>"
                Me.div_search_categories.InnerHtml += "<select class='select'>"
                Me.div_search_categories.InnerHtml += "<option value=''>All Categories</option>"
                While reader.Read
                    Me.div_categories.InnerHtml += "<li>"
                    Me.div_categories.InnerHtml += " <a href='#'>"
                    Me.div_categories.InnerHtml += "<span class='cat-thumb'>"
                    Me.div_categories.InnerHtml += "<img alt='' src='img/icon/3.png'>"
                    Me.div_categories.InnerHtml += "</span>"
                    Me.div_categories.InnerHtml += ValueOrDefault(reader("CategoryName"), "")
                    Me.div_categories.InnerHtml += "</a>"
                    Me.div_categories.InnerHtml += "</li>"

                    Me.div_search_categories.InnerHtml += "<option value=''>" + ValueOrDefault(reader("CategoryName"), "") + "</option>"
                    
                End While
                Me.div_categories.InnerHtml += "</ul>"
                Me.div_search_categories.InnerHtml += "</select>"
            End Using
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

End Class